package com.shinan.rabbittest.action;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitConfig {

    @Bean
    public Queue queue() {
        return new Queue("hello");
    }

    @Bean
    public Queue queue2() {
        return new Queue("hello2");
    }

    @Bean
    public DirectExchange exchange() {
        return new DirectExchange("exchange");
    }
    @Bean
    Binding bindingExchangeMessage(Queue queue, DirectExchange exchange) {
        return BindingBuilder.bind(queue).to(exchange).with("binding1");
    }

    @Bean
    Binding bindingExchangeMessage2(Queue queue2, DirectExchange exchange) {
        return BindingBuilder.bind(queue2).to(exchange).with("binding2");
    }
}